package com.neu.elm.mapper;

import com.neu.elm.po.Cart;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author:csw
 * @Date: 10:43 2020/9/15
 */
@Mapper
public interface CartMapper {

    //保存购物车(1表示购买数量)
    @Insert("insert into cart values(null,#{foodId},#{businessId},#{userId},1)")
    public int saveCart(Cart cart);

    //修改购物车(修改购物车中的商平数量)
    @Update("update cart set quantity=#{quantity} where foodId=#{foodId} and businessId=#{businessId} and userId=#{userId}")
    public int updateCart(Cart cart);


    //购物车全查
    public List<Cart> listCart(Cart car);

    //删除购物车
    public int removeCart(Cart cart);

}
